Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename working_dir to workdir for consistency #332

Closed
wants to merge 1 commit into from

Conversation

aparcar
Copy link
Contributor

@aparcar aparcar commented Sep 29, 2023

Currently podman-py uses all three versions of work_dir, working_dir and workdir (not to mention WorkingDir).

This commit tries to unify the parameter usage by allowing workdir for container create or run. For backwards compatibility working_dir still works but a deprecation warning is added.

Since upstream Podman uses a variety of workdir versions the podman-py codebase can't be simplified further.

Fix: #330

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 29, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aparcar
Once this PR has been reviewed and has the lgtm label, please assign jwhonce for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Currently `podman-py` uses all three versions of `work_dir`,
`working_dir` and `workdir` (not to mention `WorkingDir`).

This commit tries to unify the parameter usage by allowing `workdir` for
container `create` or `run`. For backwards compatibility `working_dir`
still works but a deprecation warning is added.

Since upstream Podman uses a variety of *workdir* versions the
`podman-py` codebase can't be simplified further.

Fix: containers#330

Signed-off-by: Paul Spooren <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2023

LGTM
@umohnani8 @jwhonce @mwhahaha PTAL

@umohnani8
Copy link
Member

Changes LGTM
gating is unhappy due to a format issue https://github.com/containers/podman-py/pull/332/checks?check_run_id=17258548350

Comment on lines +407 to +409
if "working_dir" in args:
warnings.warn("working_dir is deprecated, use workdir instead", PendingDeprecationWarning)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the warning. The library is intended to be a super set of the Docker SDK which uses working_dir as their parameter. I have no issue with workdir being added as an "alias".

@@ -287,7 +288,7 @@ def create(
}

volumes_from (List[str]): List of container names or IDs to get volumes from.
working_dir (str): Path to the working directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retain this comment, see below.

self.client.containers.create(
self.alpine_image, working_dir="/tmp", command=["/bin/ls", "-l", "/"]
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for including a test, but it will need to be adjusted to verify workdir works as expected.

@rhatdan
Copy link
Member

rhatdan commented Nov 12, 2023

@aparcar still working on this?

@rhatdan
Copy link
Member

rhatdan commented Jan 22, 2024

@umohnani8 Could you take this over and get it merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify usage of workdir, work_dir and working_dir
4 participants